// JavaScript File
var express = require('express');
var router = express.Router();
var jwt = require('express-jwt');
var auth = jwt({
  secret: process.env.JWT_SECRET,
  userProperty: 'payload'
});

var ctrlHospital = require('../controllers/hospital.ctl');
var ctrlAuth = require('../controllers/authentication');
var ctrlDoctor = require('../controllers/doctor.ctl');
var systemInfo = require('../controllers/systeminfo');

//router.get('/hospitals', ctrlHospital.showList);
router.post('/userhislist', ctrlHospital.showList);
router.post('/hospitals', ctrlHospital.create);
router.get('/hospitals/edit/:hid', ctrlHospital.readOne);
router.put('/hospitals/edit/:hid', ctrlHospital.updateOne);
router.delete('/hospitals/:hid', ctrlHospital.deleteOne);

//doctor
router.post('/userdoclist/:type', ctrlDoctor.showList);
router.post('/doctors', ctrlDoctor.create);
router.get('/doctors/edit/:did', ctrlDoctor.readOne);
router.put('/doctors/edit/:did', ctrlDoctor.updateOne);
router.delete('/doctors/:did', ctrlDoctor.deleteOne);


// authentication
router.post('/users/register', ctrlAuth.register);
router.put('/users/update/:uid', ctrlAuth.updateUser);
router.get('/users/update/:uid/:state', ctrlAuth.updateUserStatus);
router.post('/users/login', ctrlAuth.login);
router.get('/users/userlist', ctrlAuth.userList);
router.delete('/users/:uid', ctrlAuth.deleteUser);

router.get('/sysinfo', systemInfo.getSystemInfo);
module.exports = router;
